import Https from '@/utils/https'

const getLastUpdateTime = (params) => Https.get('/api/v1/normalization/datasource/getLastUpdateTime', params, { needCode: true })

// 获取Schemas
const getSchemas = (params) => Https.post('/api/v1/normalization/datasource/getSchemas', params)

// 删除数据源
const deleteDataSourceById = (params) => Https.post('/api/v1/normalization/datasource/deleteDataSourceById', params, { json: false })
// 添加或者编辑存储
const saveHive = (params) => Https.post('/api/v1/normalization/datasource/saveHive', params, { needCode: true })
const saveMqtt = (params) => Https.post('/api/v1/normalization/datasource/saveMqtt', params, { needCode: true })
const saveRdbms = (params) => Https.post('/api/v1/normalization/datasource/saveRdbms', params, { needCode: true })
const saveMongo = (params) => Https.post('/api/v1/normalization/datasource/saveMongo', params, { needCode: true })
const saveKafka = (params) => Https.post('/api/v1/normalization/datasource/saveKafka', params, { needCode: true })
const saveHBase = (params) => Https.post('/api/v1/normalization/datasource/saveHBase', params, { needCode: true })
const saveHDFS = (params) => Https.post('/api/v1/normalization/datasource/saveHDFS', params, { needCode: true })
const saveMaxCompute = (params) => Https.post('/api/v1/normalization/datasource/saveMaxCompute', params, { needCode: true })
const saveOpentsdb = (params) => Https.post('/api/v1/normalization/datasource/saveOpentsdb', params, { needCode: true })
const saveDgraph = (params) => Https.post('/api/v1/normalization/datasource/saveDgraph', params, { needCode: true })
const saveIoTDB = (params) => Https.post('/api/v1/normalization/datasource/saveIoTDB', params, { needCode: true })
const saveInfluxDB = (params) => Https.post('/api/v1/normalization/datasource/saveInfluxDB', params, { needCode: true })

// 获取详情
const getDataSourceDetailById = (params) => Https.get('/api/v1/normalization/datasource/getDataSourceDetailById', params)
// 测试连接
const testHiveConnection = (params) => Https.post('/api/v1/normalization/datasource/testHiveConnection', params, { needCode: true })
const testKafkaConnection = (params) => Https.post('/api/v1/normalization/datasource/testKafkaConnection', params, { needCode: true })
const testMongoConnection = (params) => Https.post('/api/v1/normalization/datasource/testMongoConnection', params, { needCode: true })
const testMqttConnection = (params) => Https.post('/api/v1/normalization/datasource/testMqttConnection', params, { needCode: true })
const testRdbmsConnection = (params) => Https.post('/api/v1/normalization/datasource/testRdbmsConnection', params, { needCode: true })
const testOpentsdbConnection = (params) => Https.post('/api/v1/normalization/datasource/testOpentsdbConnection', params, { needCode: true })
const testHDFSConnection = (params) => Https.post('/api/v1/normalization/datasource/testHDFSConnection', params, { needCode: true })
const testHBaseConnection = (params) => Https.post('/api/v1/normalization/datasource/testHBaseConnection', params, { needCode: true })
const testDrapghConnection = (params) => Https.post('/api/v1/normalization/datasource/testDrapghConnection', params, { needCode: true })
const testMaxComputeConnection = (params) => Https.post('/api/v1/normalization/datasource/testMaxComputeConnection', params, { needCode: true })
const testIoTDBConnection = (params) => Https.post('/api/v1/normalization/datasource/testIoTDBConnection', params, { needCode: true })
const testInfluxDBConnection = (params) => Https.post('/api/v1/normalization/datasource/testInfluxDBConnection', params, { needCode: true })

// 删除空间
const deleteProject = (params) => Https.get('/api/v1/management/user/project/deleteProject', params)

// 创建空间
const addProject = (params) => Https.post('/api/v1/management/user/project/addProject', params, { needCode: true })

export {
  getSchemas, deleteDataSourceById, saveOpentsdb, saveDgraph, saveMaxCompute, saveHDFS, saveHive, saveRdbms, getDataSourceDetailById,
  saveMqtt, testDrapghConnection, testHBaseConnection, testHiveConnection, saveMongo, saveKafka, saveHBase, testHDFSConnection,
  testOpentsdbConnection, testKafkaConnection, testMongoConnection, testMqttConnection, testRdbmsConnection, testMaxComputeConnection,
  getLastUpdateTime, testIoTDBConnection, saveIoTDB, saveInfluxDB, testInfluxDBConnection, deleteProject, addProject,
}
